home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / telecomm / fnordadl / fn132src.zoo / ref-man / shells.tex < prev    next >
Encoding:
Text File  |  1991-09-02  |  12.5 KB  |  262 lines

  1. @comment Tell Emacs to use -*-texinfo-*- mode
  2. @comment $Id: shells.tex,v 2.2 91/09/01 23:04:43 royce Exp $
  3.  
  4. @node Shells vs. the Desktop, File Transfers, Anti-Ruggie Measures, Top
  5. @chapter Shells vs. the Desktop
  6. @cindex Shells vs. the desktop
  7.  
  8. On the Atari ST, the standard environment is the @sc{gem} Desktop (that
  9. screen full of disk drive icons, windows, pull-down menus and so on).  But
  10. one may also choose to run the system by means of a ``shell'' or ``@sc{cli}''
  11. (which stands for Command Line Interface).  Instead of double-clicking on
  12. an icon to run a program, you type its name; instead of dragging icons
  13. around to copy files, you type a command like @samp{cp file1 file2}; et cetera.
  14. In this Chapter, we'll discuss how the choice of desktop vs. shell affects
  15. the operation of Fnordadel.
  16.  
  17. From day one, the Citadel system has been designed around the
  18. command-line style of operation, and Fnordadel hasn't changed this;
  19. most programs in the distribution take arguments on the command line to
  20. determine their behaviour.  This is antithetical to the mouse-driven,
  21. interactive philosophy of @sc{gem}, but it doesn't mean that you can't run
  22. Fnordadel from the desktop.  You just have to kludge things around a
  23. bit.
  24.  
  25. @node Running from the Desktop, Running from a Shell, Shells vs. the Desktop, Shells vs. the Desktop
  26. @section Running from the Desktop
  27. @cindex Desktop, running Fnordadel from
  28. @cindex Running from the desktop
  29.  
  30. There are a few things you need to know.  Firstly, all the
  31. programs in the distribution come with a @file{.tos} extender.  As with standard
  32. ST usage, this means that the programs use no @sc{gem} features of any
  33. kind---just @sc{tos}.  (As an aside: someone once suggested that we graft a
  34. @sc{gem} front-end onto @code{citadel}.  His body hasn't surfaced yet.).
  35.  
  36. So, what this means for desktop users is that double-clicking on a
  37. Fnordadel program will simply launch the program; the program will not
  38. be supplied with any command-line arguments.  For some programs, this is
  39. @pindex citadel
  40. fine, but for others, notably @code{citadel}, it isn't.  The solution?
  41. Rename the programs to which you would like to supply arguments to
  42. @samp{@var{program}.ttp}.  Now when you run them from the desktop,
  43. a dialogue box will
  44. pop up asking for the command line arguments to be supplied.  Type them
  45. and hit @samp{<CR>} (or click on @samp{OK}) to launch the program.
  46.  
  47. This doesn't entirely solve the problem, because complex programs
  48. like @code{citadel} can take far more parameters than can be fit into the small
  49. space provided by the @sc{gem} @code{.ttp} parameter dialogue box.  Also,
  50. the @sc{gem} dialogue
  51. converts all the parameters you type into upper-case before giving them to the
  52. program.  This is a Bad Thing if the program in question is expecting
  53. lower-case values.  Fortunately, we've tried to eliminate this problem in all
  54. Fnordadel programs by not checking case with parameters.
  55.  
  56. There are companies that make enhancement or replacement products for
  57. the @sc{gem} Desktop, such as NeoDesk 3 by Gribnif Software and Hotwire by CodeHead
  58. Software.  Some of these products replace the normal @sc{gem} parameter dialogue
  59. with one that will accept more parameters, or doesn't convert them to
  60. upper-case, or both.  It might be worth your while to investigate some of these
  61. products if you're having trouble using Fnordadel to its fullest, but like
  62. working in a graphical, mouse-oriented environment.  (We have never used any
  63. of these products ourselves, so we're unable to recommend them.  However, if
  64. you try them out and find them useful, let us know how and why so we can record
  65. that fact in future versions of this manual.)
  66.  
  67. We've tried to make all of the programs in the Fnordadel
  68. distribution decently desktop-friendly.  (Or, at least, not as blindingly
  69. unfriendly as before.)  They can detect when they have been run from the
  70. desktop, and will always prompt you to ``hit any key'' before they exit.
  71. @pindex clog
  72. @pindex popular
  73. For programs like @code{clog}, @code{popular}, et cetera, this is a lifesaver.
  74. (Note that this ``hit any key'' business is only from the desktop; if you
  75. run a Fnordadel program from a shell, or from a door within Fnordadel,
  76. or whatever, it won't do this.)
  77.  
  78. @node A desktop trick,  , Running from the Desktop, Running from the Desktop
  79. @subheading A desktop trick
  80.  
  81. A trick that used to be popular back in the days when people ran
  82. ST Citadels on tiny one-drive systems was to fool the ST into thinking
  83. you had two drives, in the following manner:
  84. @enumerate
  85. @item
  86. Arrange your files so that all of your startup
  87. stuff (@code{auto} folder, @file{configur.tos}, @file{citadel.tos}, et cetera)
  88. is on a disk marked ``A'',
  89. and all of your @sc{bbs} data files are on a disk marked ``B''.
  90. @item
  91. Edit
  92. @file{ctdlcnfg.sys} to point @code{#msgdir}, @code{#sysdir}, et cetera,
  93. @vindex msgdir
  94. @vindex sysdir
  95. at drive @code{B:} rather than
  96. drive @code{A:}.
  97. @item
  98. Now here's the trick: rename the Fnordadel binaries from @code{.tos} to
  99. @file{.prg} extensions.
  100. @item
  101. When you boot from disk ``A'' and run @code{citadel}
  102. @sc{gem} will
  103. pop up that familiar ``Insert Disk B into Drive A'' box, and off you go!
  104. Fnordadel will work as normal; the computer will see the data files as
  105. being on drive B:, but that's fine by us.
  106. @end enumerate
  107. A word of caution:  Many a
  108. Sysop employing this technique has come home to find his @sc{bbs} frozen at a
  109. ``Please insert Disk A into Drive A'' box.  Make sure that all the directories
  110. your system needs during normal operation start with @code{B:\@dots{}}
  111. rather than
  112. @code{A:\@dots{}}.  This includes system file directories in
  113. @file{ctdlcnfg.sys}, directories
  114. attached to directory rooms, pathnames of files used to archive rooms, etc.
  115.  
  116. Also note that using this trick requires naming all Fnordadel
  117. programs that you intend to use (@file{citadel.tos}, @file{configur.tos},
  118. utilities) with
  119. the @file{.prg} extender.  Unfortunately,
  120. a side-effect is that you can no longer
  121. supply any command-line parameters to these programs.  Some of the
  122. third-party @sc{gem} enhancements/replacements referred to above may solve
  123. this problem
  124. by letting you have a parameter dialogue box for use with @code{.prg} programs
  125. as well as @code{.ttp} ones.  Also, Double Click is rumoured to have
  126. released a neat hack to allow passing parameters to @code{.prg} programs.
  127.  
  128. If you do run Fnordadel from the desktop, be warned that you're
  129. missing out on some stuff.  The primary thing is that the desktop has no
  130. way of catching return codes from programs.  (Programs on the ST may return
  131. an integer exit value to the calling program; it's a way of indicating
  132. @pindex citadel
  133. error conditions and stuff.)  @code{citadel} makes use of return codes to tell
  134. you why it is exiting; see also @ref{Events}.
  135.  
  136. The bottom line, then, is that while you can hack your way into
  137. increased functionality when trying to use Fnordadel from the @sc{gem} Desktop,
  138. you won't ever be able to fully exploit the system's capabilities until you
  139. start using a command shell of some kind.  If you're interested in doing so,
  140. read on.
  141.  
  142. @node Running from a Shell,  , Running from the Desktop, Shells vs. the Desktop
  143. @section Running from a Shell
  144. @cindex Shell, running Fnordadel from
  145. @cindex Running from a shell
  146. @cindex CLI, running Fnordadel from
  147.  
  148. If your system has a hard disk, using a shell is highly recommended.
  149. One reason for this is the concept of the ``path'', a list of
  150. directories you define that
  151. tells the shell where to look for programs that you wish to execute.  Thus
  152. you don't have to know which directory a program is in to run it, as long
  153. as the directory is on your path.  Some @sc{gem} enhancements/replacements offer
  154. a similar function (e.g. Hotwire), but you have to set things up a program at
  155. a time, and then call them using ``hot-keys'' from the Desktop.  Is
  156. it easier to
  157. remember to press @code{Control-Alt-F7} to run
  158. @code{citadel}, or to simply type @samp{citadel}
  159. and hit return?
  160.  
  161. If you've got only floppies, we still recommend using a shell,
  162. especially if you have 1MB or more of @sc{ram}.  (If you have 512K of @sc{ram}, get an
  163. upgrade; they're cheap and you'll be glad you did.)  It will make life
  164. easier.  Both Fnordadel developers are fans of the public domain @code{gulam}
  165. shell.  It's what we use full-time; our systems auto-boot straight into
  166. @code{gulam}, so about the only time we see the @sc{gem} Desktop is if
  167. @code{gulam} crashes.
  168. Fortunately, that's rare.  If you want a copy of @code{gulam}, let us
  169. know and we can supply you with one, or just ask around your local area---it's
  170. everywhere.
  171.  
  172. There are many reasons to use a shell to run Fnordadel.
  173. Some were mentioned above:  to supply more parameters to programs;
  174. to avoid parameter conversion to upper-case (although some shells
  175. do this too, notably @code{pcommand} and @code{command.tos}); to avoid
  176. having @sc{gem}
  177. erase the output of a program before you can see it; etc.  A further
  178. benefit of @code{gulam} is that it has a built-in version of
  179. the powerful microEmacs
  180. text editor, which is very handy for people who frequently edit
  181. text files.
  182.  
  183. However, we think the main reason you'll want to use a shell
  184. to run Fnordadel is that shells can catch the values returned by
  185. programs and, with most shells, can be setup to do different things
  186. depending on which code was returned.  You'll want to use this in
  187. conjunction with events (@pxref{Events}), because each event causes
  188. Fnordadel to exit with a different specific code.  You'll also
  189. want to use this even if you have no events defined, because
  190. @pindex citadel
  191. @code{citadel} itself uses a few result codes to indicate different
  192. exit conditions.
  193.  
  194. We have included a sample gulam shellscript called @file{bbs.g} in
  195. the distribution.  It's for
  196. managing the overall operation of your system; to start up
  197. your @sc{bbs} with it, simply edit it as required, put it somewhere
  198. pointed to by your @code{PATH}, and type @samp{bbs}.  The script is reprinted
  199. for convenience below:
  200.  
  201. @example
  202. set continue 1          # 'continue' flag
  203. set oldpath $path       # save the old path and set a new one
  204. set path c:\bin,e:\citmain,e:\citnet,e:\citutil,e:\
  205. cd e:\                  # change directory to where ctdltabl.sys lives
  206.  
  207. while @{ $continue > 0 @}         # Loop until we set 'continue' to '0'
  208.  
  209.     if @{ -e ctdltabl.sys @} == 0         # is ctdltabl.sys there?
  210.         configur x                      # If not, reconfigure.
  211.     endif
  212.  
  213.     citadel +line +ymodem +purge        # run citadel
  214.  
  215.     if @{ $status == 0 @}                 # Did citadel.tos return '0'?
  216.         set continue 0                  # If so, it was ^LQ from the    
  217.         echo 'Normal console termination.'      # Console.
  218.  
  219.     ef @{ $status == 1 @}                 # Did it return '1'?
  220.         echo 'Performing regular backup...'     # If so, it was a
  221.         cp -R d:\secret\sys g:\backup   # defined Timeout (see the 
  222.         cp -R d:\secret\net g:\backup   # Reference Manual and
  223.         cp -R d:\secret\audit g:\backup # ctdlcnfg.doc).
  224.         echo 'Finished.'
  225.  
  226.     ef @{ $status == 2 @}                 # Did it return '2'?
  227.         set continue 0                  # It crashed. The file 'crash'
  228.         echo 'Something must be buggered.'    # may help explain why.
  229.  
  230.     ef @{ $status == 3 @}                 # Did it return '3'?
  231.         set continue 0                  # That means someone used ^LQ
  232.         echo 'Somebody took it down from remote.'       # from remote.
  233.  
  234.     ef @{ $status == 255 @}               # Did it return '255'?
  235.         set continue 0                  # **BOOM!**  Can try checking 
  236.         echo 'Something is REALLY* buggered.'   # 'crash', but....
  237.  
  238.     ef @{ $status == 15 @}                # Here's another #event! This
  239.         echo 'Exercising the feeping creatures...'     # one is for
  240.         clog -t > d:\secret\library\userlog.sys        # nightly stats
  241.         popular -msb > d:\secret\library\popular.sys   # gathering and
  242.         callstat -c                                    # stuff like
  243.         cp d:\secret\audit\callbaud.sys d:\secret\library # that...
  244.         cp d:\secret\audit\callstat.sys d:\secret\library
  245.     endif
  246. endwhile                        # ....and loop back to the top again.
  247.  
  248. # if we reach here, it means that something up there set 'continue'
  249. # to '0', meaning we're supposed to quit.
  250. set path $oldpath               # Reset the path we had before
  251. unset oldpath                   # and remove the variable.
  252. # Done!
  253. @end example
  254.  
  255. Everything in the above script should be pretty much self-explanatory.  Make
  256. sure that @code{path} is set to point at directories
  257. containing your Fnordadel binaries; that way you can type stuff
  258. like @samp{callstat -c} and the shell will find where @code{callstat} lives.  
  259. @pindex callstat
  260. If you have another kind of shell, the same principles should apply,
  261. though the mechanics may vary.
  262.